package file;
import java.io.File;
import java.io.IOException;

/**java.io.File文件演示*/
public class FileDemo {
    public static void main(String[] args) throws IOException {
        File file=new File("D:/Idea_java/text.txt");
        //获取已有文件对象赋值给file1
        File file1=new File("./demo.txt");
        String name=file1.getName();
        System.out.println(name);
        long len=file1.length();
        System.out.println(len);
        //file1.delete();
        System.out.println(file.isFile());
        file.createNewFile();
        System.out.println(file.getPath());
      //  File file2=file1.getAbsoluteFile();
        System.out.println(file1.getAbsolutePath());
        System.out.println(file1.getCanonicalPath());

    }
}
